#!/usr/bin/perl
#createnv.cgi	Create a net volume1

require './folderman-lib.pl';

&ReadParse();
my @fvinfo = get_nvinfo();

my @freevolumes=get_free_netvol(@fvinfo);

&header($text{'title_createnv'}, "", "createnv", 0, 1);
print $num;
print "<form name='createnv' action=actcreate.cgi method=post onsubmit='on_form_submit()'>\n";
print "<table class=mode1 width=80%>\n";

print "<tr><td>$text{'nvname'}</td><td>";
print "<select name=volname class=drop>";
$i = 0;
my $fv;
foreach $fv (@freevolumes) {
	if ($i == 0) {
		print "<option selected value=$fv>$fv";
	}
	else{
		print "<option value=$fv>$fv";
	}
	$i++;
}

print "</select>";
print "</td></tr>\n";
print "<tr><td width=150>$text{'ip'}</td><td><input type=text name=ip class=text></td></tr>\n";
print "<tr><td>$text{'sharepath'}</td><td><input type=text name=sharepath class=text></td></tr>\n";
print "<tr><td>$text{'autoconn'}</td><td><input type=checkbox name=autoconn></td></tr>\n";
print "</table><table class=mode1 width=80%>";
print "<tr><td><input type=submit name=ok class=button value=$text{'btn_ok'}></td></tr>\n";
print "</table>\n";

print "<input type=hidden name=automark>\n";
print "</form>\n";
print <<EOF;
<script>
function on_form_submit()
{
	if(document.createnv.autoconn.checked){
		document.createnv.automark.value = 1;
	}
	else{
		document.createnv.automark.value = 0;
	}

}
</script>
EOF

&footer("index.cgi", $text{'index'});

